﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPage/Admin.master" AutoEventWireup="true" CodeFile="Hotel.aspx.cs" Inherits="SBRUSYS_AdminPage_hotel" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style9
        {
            width: 245px;
        }
        .style10
        {
            width: 266px;
        }
        .style11
        {
            width: 266px;
            height: 25px;
            margin-left: 40px;
        }
        .style12
        {
            height: 25px;
        }
        .style14
        {
            width: 177px;
            height: 25px;
        }
        .style15
        {
            width: 193px;
            height: 25px;
        }
        .style17
        {
            height: 25px;
        }
        .style18
        {
            height: 25px;
        }
        .style19
        {
            width: 192px;
            height: 25px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
    <div>
        <table class="style1">
            <tr>
                <td class="style12">
                    按地区搜索：</td>
                <td class="style19">
&nbsp;<asp:DropDownList ID="Pro" runat="server" AutoPostBack="True" 
                        DataSourceID="SqlDataSource1Pro" DataTextField="province" 
                        DataValueField="ProID" Height="22px" 
                        Width="142px" >
                    </asp:DropDownList>
                    省</td>
                <td class="style14">
&nbsp;<asp:DropDownList ID="City" runat="server" AutoPostBack="True" 
                        DataSourceID="SqlDataSource1CT" DataTextField="city" DataValueField="CityID" 
                        Height="22px" Width="128px">
                    </asp:DropDownList>
                    市</td>
                <td class="style15">
&nbsp;<asp:DropDownList ID="Country" runat="server" AutoPostBack="True" 
                        DataSourceID="SqlDataSource1Cou" DataTextField="county" 
                        DataValueField="CountyId" Height="22px" Width="128px">
                    </asp:DropDownList>
                    县</td>
                <td class="style11">
                    <asp:Button ID="Button2" runat="server" Text="搜索" onclick="Button2_Click" />
                &nbsp;</td>
                <td class="style12">
                </td>
                <td class="style12">
                </td>
            </tr>
            <tr>
                <td class="style17">
                    按名称搜索：</td>
                <td class="style18" colspan="2">
                    宾馆名称 
                    <asp:TextBox ID="TextBox1" 
            runat="server" Width="159px" Height="22px"></asp:TextBox>
                &nbsp; <asp:Button ID="Button1" runat="server" Text="搜索" onclick="Button1_Click" />
                </td>
                <td class="style15">
                    &nbsp;</td>
                <td class="style11">
                    &nbsp;</td>
                <td class="style12">
                    &nbsp;</td>
                <td class="style12">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style17">
                    &nbsp;</td>
                <td class="style18" colspan="2">
                    &nbsp;</td>
                <td class="style15">
                    &nbsp;</td>
                <td class="style11">
                    &nbsp;</td>
                <td class="style12">
                    &nbsp;</td>
                <td class="style12">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style17" colspan="5">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="hotelID" 
                        DataSourceID="SqlDataSource1Hotel" Visible="False" CellSpacing="5" 
                        Width="720px">
                        <Columns>
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                            <asp:BoundField DataField="hotelID" HeaderText="宾馆ID" ReadOnly="True" 
                                SortExpression="hotelID" />
                            <asp:BoundField DataField="hotelname" HeaderText="宾馆名称" 
                                SortExpression="hotelname" />
                            <asp:BoundField DataField="ProID" HeaderText="省ID" SortExpression="ProID" />
                            <asp:BoundField DataField="CityID" HeaderText="市ID" 
                                SortExpression="CityID" />
                            <asp:BoundField DataField="CountyId" HeaderText="县Id" 
                                SortExpression="CountyId" />
                            <asp:BoundField DataField="telephonenumber" HeaderText="联系电话" 
                                SortExpression="telephonenumber" />
                            <asp:BoundField DataField="address" HeaderText="地址" 
                                SortExpression="address" />
                        </Columns>
                    </asp:GridView>
                    <div>
                    </div>
                    <asp:SqlDataSource ID="SqlDataSource1Hotel" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        OldValuesParameterFormatString="original_{0}" 
                        
                        SelectCommand="SELECT DISTINCT * FROM [Hotel] WHERE (([ProID] = @ProID) AND ([CityID] = @CityID) AND ([CountyId] = @CountyId))">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="Pro" Name="ProID" PropertyName="SelectedValue" 
                                Type="Int32" />
                            <asp:ControlParameter ControlID="City" Name="CityID" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:ControlParameter ControlID="Country" Name="CountyId" 
                                PropertyName="SelectedValue" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
                <td class="style12">
                    &nbsp;</td>
                <td class="style12">
                    &nbsp;</td>
            </tr>
        </table>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:GridView ID="GridView2" runat="server" 
            AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
            DataKeyNames="hotelID" DataSourceID="SqlDataSource1Hotel1" Width="722px">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="hotelID" HeaderText="宾馆ID" ReadOnly="True" 
                    SortExpression="hotelID" />
                <asp:BoundField DataField="hotelname" HeaderText="宾馆名称" 
                    SortExpression="hotelname" />
                <asp:BoundField DataField="ProID" HeaderText="省ID" SortExpression="ProID" />
                <asp:BoundField DataField="CityID" HeaderText="市ID" 
                    SortExpression="CityID" />
                <asp:BoundField DataField="CountyId" HeaderText="县CountyId" 
                    SortExpression="CountyId" />
                <asp:BoundField DataField="telephonenumber" HeaderText="联系电话" 
                    SortExpression="telephonenumber" />
                <asp:BoundField DataField="address" HeaderText="地址" 
                    SortExpression="address" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1Hotel1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnString %>" 
            
            SelectCommand="SELECT * FROM [Hotel] WHERE ([hotelname] LIKE '%' + @hotelname + '%')" 
            ConflictDetection="CompareAllValues" 
            DeleteCommand="DELETE FROM [Hotel] WHERE [hotelID] = @original_hotelID AND [hotelname] = @original_hotelname AND (([ProID] = @original_ProID) OR ([ProID] IS NULL AND @original_ProID IS NULL)) AND (([CityID] = @original_CityID) OR ([CityID] IS NULL AND @original_CityID IS NULL)) AND (([CountyId] = @original_CountyId) OR ([CountyId] IS NULL AND @original_CountyId IS NULL)) AND [telephonenumber] = @original_telephonenumber AND [address] = @original_address" 
            InsertCommand="INSERT INTO [Hotel] ([hotelID], [hotelname], [ProID], [CityID], [CountyId], [telephonenumber], [address]) VALUES (@hotelID, @hotelname, @ProID, @CityID, @CountyId, @telephonenumber, @address)" 
            OldValuesParameterFormatString="original_{0}" 
            UpdateCommand="UPDATE [Hotel] SET [hotelname] = @hotelname, [ProID] = @ProID, [CityID] = @CityID, [CountyId] = @CountyId, [telephonenumber] = @telephonenumber, [address] = @address WHERE [hotelID] = @original_hotelID AND [hotelname] = @original_hotelname AND (([ProID] = @original_ProID) OR ([ProID] IS NULL AND @original_ProID IS NULL)) AND (([CityID] = @original_CityID) OR ([CityID] IS NULL AND @original_CityID IS NULL)) AND (([CountyId] = @original_CountyId) OR ([CountyId] IS NULL AND @original_CountyId IS NULL)) AND [telephonenumber] = @original_telephonenumber AND [address] = @original_address">
            <DeleteParameters>
                <asp:Parameter Name="original_hotelID" Type="String" />
                <asp:Parameter Name="original_hotelname" Type="String" />
                <asp:Parameter Name="original_ProID" Type="Int32" />
                <asp:Parameter Name="original_CityID" Type="Int32" />
                <asp:Parameter Name="original_CountyId" Type="Int32" />
                <asp:Parameter Name="original_telephonenumber" Type="String" />
                <asp:Parameter Name="original_address" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="hotelID" Type="String" />
                <asp:Parameter Name="hotelname" Type="String" />
                <asp:Parameter Name="ProID" Type="Int32" />
                <asp:Parameter Name="CityID" Type="Int32" />
                <asp:Parameter Name="CountyId" Type="Int32" />
                <asp:Parameter Name="telephonenumber" Type="String" />
                <asp:Parameter Name="address" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1" Name="hotelname" PropertyName="Text" 
                    Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="hotelname" Type="String" />
                <asp:Parameter Name="ProID" Type="Int32" />
                <asp:Parameter Name="CityID" Type="Int32" />
                <asp:Parameter Name="CountyId" Type="Int32" />
                <asp:Parameter Name="telephonenumber" Type="String" />
                <asp:Parameter Name="address" Type="String" />
                <asp:Parameter Name="original_hotelID" Type="String" />
                <asp:Parameter Name="original_hotelname" Type="String" />
                <asp:Parameter Name="original_ProID" Type="Int32" />
                <asp:Parameter Name="original_CityID" Type="Int32" />
                <asp:Parameter Name="original_CountyId" Type="Int32" />
                <asp:Parameter Name="original_telephonenumber" Type="String" />
                <asp:Parameter Name="original_address" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
&nbsp;<table class="style1">
            <tr>
                <td class="style9">
                    &nbsp;</td>
                <td class="style10">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style9">
        <asp:SqlDataSource ID="SqlDataSource1Pro" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnString %>" 
            SelectCommand="SELECT * FROM [ProvinceTable]"></asp:SqlDataSource>
                </td>
                <td class="style10">
                    <asp:SqlDataSource ID="SqlDataSource1CT" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        SelectCommand="SELECT DISTINCT * FROM [CityTable] WHERE ([ProID] = @ProID)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="Pro" Name="ProID" PropertyName="SelectedValue" 
                                Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
                <td>
                    <asp:SqlDataSource ID="SqlDataSource1Cou" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        SelectCommand="SELECT DISTINCT * FROM [CountyTable] WHERE ([CityID] = @CityID)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="City" Name="CityID" 
                                PropertyName="SelectedValue" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style9">
                    &nbsp;</td>
                <td class="style10">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>
</div>
</asp:Content>

